from typing import Optional

from sqlmodel import Field, SQLModel

from app.models.base import IdType


class RoleMenu(SQLModel, table=True):
    __tablename__ = "role_menu"
    role_id: Optional[IdType] = Field(
        default=None,
        nullable=False,
        index=True,
        foreign_key="role.id",
        primary_key=True,
    )
    menu_id: Optional[IdType] = Field(
        default=None,
        nullable=False,
        index=True,
        foreign_key="menu.id",
        primary_key=True,
    )
